/*
* Poppy Game Engine - https://pgetemplate.googlecode.com/svn/
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* Copyright (c) 2008 Poppy
*/

#pragma once

#ifndef WIN32_LEAN_AND_MEAN

#ifndef FALSE
#define FALSE   0
#endif
#ifndef TRUE
#define TRUE    1
#endif
#ifndef NULL
#define NULL    0
#endif

typedef unsigned long       DWORD;
typedef int                 BOOL;
typedef unsigned char       BYTE;
typedef unsigned short      WORD;
typedef float               FLOAT;
typedef double				DOUBLE;

typedef int                 INT;
typedef unsigned int        UINT;
typedef unsigned int        *PUINT;

typedef char				CHAR;
typedef wchar_t				WCHAR;

#ifdef UNICODE
typedef WCHAR				TCHAR;
#else
typedef char				TCHAR;
#endif

typedef WCHAR *				LPWSTR;
typedef const WCHAR *		LPCWSTR;
typedef TCHAR *				LPTSTR;
typedef const TCHAR *		LPCTSTR;
typedef CHAR *				LPSTR;
typedef const CHAR *		LPCSTR;
typedef BYTE *				LPBYTE;

#endif

#ifndef NULL
#define NULL 0
#endif

#ifndef TRUE
#define TRUE 1
#endif

#ifndef FALSE
#define FALSE 0
#endif

#ifndef SAFE_DELETE
#define SAFE_DELETE(p)					{ if(p) { delete (p);     (p)=NULL; } }
#endif
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p)			{ if(p) { delete[] (p);   (p)=NULL; } }
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p)					{ if(p) { (p)->Release(); (p)=NULL; } }
#endif

#ifndef SAFE_WIPE_ATTRIBUTE
#define SAFE_WIPE_ATTRIBUTE(variable,cons) (variable &= (~cons))
#endif

#ifndef SAFE_ADD_ATTRIBUTE
#define SAFE_ADD_ATTRIBUTE(variable,cons) (variable |= cons)
#endif

#ifndef SAFE_CALL_METHOD
#define SAFE_CALL_METHOD(object,method) if(object) object->method()
#endif

#ifdef WIN32

#ifndef WIN_WIDTH_OFFSET
#define WIN_WIDTH_OFFSET 8
#endif

#ifndef WIN_HEIGHT_OFFSET
#define WIN_HEIGHT_OFFSET 34
#endif

#ifndef PGE_TICK_RESOLUTION
#define PGE_TICK_RESOLUTION __int64
#endif

#ifndef PGE_CURRENT_TICK
#define PGE_CURRENT_TICK __int64
#endif

#endif

#ifdef PSP

#include <pspkernel.h>

#ifndef PGE_TICK_RESOLUTION
#define PGE_TICK_RESOLUTION uint32_t
#endif

#ifndef PGE_CURRENT_TICK
#define PGE_CURRENT_TICK uint64_t
#endif

#endif
